<template>
        <div class="fillcontain">
            <el-form :model="formData" label-position="labelPosition" ref="formData"
                     class="demo-form-inline" style="margin-left: 10px;margin-right: 10px">
                <el-col :span="6">
                    <el-form-item label="">
                        <el-input
                            size="mini" style="width: 220px"
                            placeholder="请输入新密码"
                            prefix-icon="el-icon-search"
                            v-model="formData.newpassword">
                        </el-input>
                    </el-form-item>
                </el-col>
                <el-button type="primary" @click="this.initData" size="mini" icon="el-icon-search">重置密码</el-button>
            </el-form>
        </div>

</template>

<script>
    import {mapActions, mapState, mapGetters} from 'vuex'
    import headTop from '../components/headTop'
    import {getUserList, getUserCount,updatepwd} from '@/api/getData'

    export default {
        computed: {
            ...mapGetters(['adminInfo'])
        },

        data() {
            return {
              formData:{},
            }
        },
        components: {
            headTop,
        },
        created() {
            //this.initData();
        },
        methods: {
            async initData() {
                try {
                   // alert(JSON.stringify({"data":{"id":this.adminInfo.id,"newpassword":this.formData.newpassword}}));
                   // return;
                   const v= await updatepwd({"data":{"id":this.adminInfo.id,"newpassword":this.formData.newpassword}});

                   if(v.success==true){
                        this.$message({
                            type: 'success',
                            message: '修改密码成功!'
                        });
                    }
                } catch (err) {
                    console.log('修改密码失败', err);
                }
            }
            }
    }
</script>
